package com.xzzz.common.wechat;

import com.xzzz.common.wechat.log.WxLogAspect;
import com.xzzz.common.wechat.manager.WxAuthManager;
import com.xzzz.common.wechat.manager.WxQRCodeManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
@ConditionalOnProperty(name = "xzzz.wechat.enabled", havingValue = "true")
public class WxConfiguration {

    @Bean
    public WxLogAspect wxLogAspect() {
        return new WxLogAspect();
    }

    @Bean(name = "authWxManager")
    public WxAuthManager authWxManager() {
        return new WxAuthManager();
    }

    @Bean(name = "qrCodeWxManager")
    public WxQRCodeManager qrCodeWxManager() {
        return new WxQRCodeManager();
    }
}
